home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / GSys.lha / gsys / gsystem / GObject.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-18  |  1.1 KB  |  82 lines

  1.  
  2. /* Author Anders Kjeldsen */
  3.  
  4. #ifndef GOBJECT_CPP
  5. #define GOBJECT_CPP
  6.  
  7. #include "gsystem/GObject.h"
  8. #include "gsystem/GError.cpp"
  9.  
  10. GObject::GObject()
  11. {
  12.     memset((void *)this, 0, sizeof (GObject) );
  13. }
  14.  
  15. GObject::~GObject()
  16. {
  17. }
  18.  
  19. BOOL GObject::InitGObject(GSTRPTR type)
  20. {
  21.     strncpy(ObjectType, type, 31);
  22.     return TRUE;
  23. }
  24.  
  25. void GObject::PrintObjectType()
  26. {
  27.     printf("%s\n", ObjectType);
  28. }
  29.  
  30. GWORD GObject::GetErrors()
  31. {
  32.     GError *current = ErrorList;
  33.     GWORD i = 0;
  34.     while (current)
  35.     {
  36.         i++;
  37.         current = current->GetNextError();
  38.     }    
  39.     return i;
  40. }
  41.  
  42. BOOL GObject::IsErrorFree()
  43. {
  44.     if ( ErrorList == 0 ) return TRUE;
  45.     return FALSE;
  46. }
  47.  
  48. BOOL GObject::AddError( GSTRPTR id, GSTRPTR errormsg )
  49. {
  50.     GError *newerror = new GError(id, errormsg);
  51.  
  52.     if ( newerror )
  53.     {
  54.         if ( ErrorList )
  55.         {
  56.             return ErrorList->AttachError(newerror);
  57.         }
  58.         else
  59.         {
  60.             ErrorList = newerror;
  61.             return TRUE;    
  62.         }
  63.     }
  64. }
  65.  
  66. GError *GObject::GetFirstError()
  67. {
  68.     return ErrorList;
  69. }
  70.  
  71. void GObject::PrintErrors()
  72. {
  73.     printf("printing errors:\n");
  74.     if ( ErrorList )
  75.     {
  76.         printf("begins..\n");
  77.         ErrorList->PrintErrors();
  78.     }
  79. }
  80.  
  81.  
  82. #endif /* GOBJECT_CPP */